// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

@use 'vars/lib' as *;

.m24-c-gallery-container {
    display: grid;
    gap: $spacer-xl $grid-gutter;
    grid-template-columns: repeat(1, 1fr);
    margin-top: $spacer-xl;

    @media #{$mq-md} {
        grid-template-columns: repeat(2, 1fr);
    }

    @media #{$mq-xl} {
        grid-template-columns: repeat(12, 1fr);
    }

    & + .m24-c-section-cta {
        margin-top: $spacer-xl;
    }
}

.m24-c-gallery-tile {
    display: flex;
    flex-direction: column;
    position: relative;

    @media #{$mq-md} {
        &.m24-l-grid-three-quarters {
            grid-column: 1 / span 2;
            margin-left: grid(3);
        }
    }

    @media #{$mq-xl} {
        grid-column: auto / span 3;

        &.m24-l-grid-one {
            grid-column: auto / span;
        }

        &.m24-l-grid-third {
            grid-column: auto / span 4;
        }

        &.m24-l-grid-five {
            grid-column: auto / span 5;
        }

        &.m24-l-grid-half {
            grid-column: auto / span 6;
        }

        &.m24-l-grid-seven {
            grid-column: auto / span 7;
        }

        &.m24-l-grid-two-thirds {
            grid-column: auto / span 8;
        }

        &.m24-l-grid-three-quarters {
            grid-column: 4 / span 9;
            margin-left: 0
        }
    }
}

.m24-c-gallery-tile-title {
    font-size: 24px;
    margin-bottom: 4px;
    order: 2;
    text-decoration: underline 0.075em transparent;
    transition: text-decoration-color $fast $bezier, color $fast $bezier;

    @media #{$mq-lg} {
        font-size: 32px;
    }

    .m24-l-gallery-no-desc & {
        font-family: var(--body-font-family);
        font-size: 16px;

        @media #{$mq-lg} {
            font-family: var(--title-font-family);
            font-size: 32px;
        }
    }
}

.m24-c-gallery-tile-link {
    text-decoration: none;
    color: inherit;

    span {
        display: block;
    }

    &:hover,
    &:focus,
    &:active {
        color: inherit;
        text-decoration: underline;
    }

    &[href]::after {
        content: "";
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
      }
}

.m24-c-gallery-tile-image {
    margin-bottom: 16px;
    order: 1;

    img {
        display: block;
    }
}

.m24-c-gallery-tile-tag {
    align-items: center;
    background-color: $m24-color-alt-white;
    color: $m24-color-black;
    display: flex;
    font-size: 14px; // fixed size
    font-weight: bold;
    height: 32px;
    order: 3;
    padding: 0 8px;

    .m24-c-gallery-tile-image + & {
        @include bidi(((left, 8px, right, auto),));
        position: absolute;
        top: 8px;
    }
}

.m24-c-gallery-tile-content {
    font-size: $text-body-sm;
    order: 4;
}

.m24-c-gallery-tile-desc {
    margin-bottom: 4px;
}

.m24-c-gallery-tile-cta {
    margin-top: 16px;
    margin-bottom: 0;
}

.m24-c-gallery-tile-cta > span {
    font-size: $text-button-sm;
    font-weight: 600;
    text-decoration: underline;
}
